<!DOCTYPE html>
<html lang="en">

<head>
  <meta charset="utf-8">
  <title>step17</title>
  <meta name="renderer" content="webkit">
  <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
  <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
  <link rel="stylesheet" href="../lib/layui-v2.5.5/css/layui.css" media="all">
  <link rel="stylesheet" href="../css/public.css" media="all">
</head>

<body>
<div class="layuimini-container">
  <div class="layuimini-main">
    <div class="layui-form layuimini-form">
      <div class="layui-form-item">
        <label class="layui-form-label required">申报编号：</label>
        <div class="layui-input-block">
          <input type="text" disabled id="declare_num" name="declare_num" lay-verify="required" lay-reqtext="申报编号不能为空"
                 placeholder="请输入申报编号" value="" class="layui-input">
        </div>
      </div>
      <div class="layui-form-item">
        <label class="layui-form-label">申报类型：</label>
        <div class="layui-input-block layui-form" lay-filter="selectFilter">
          <select disabled id="declare_type" name="declare_type">
            <option value="固定资产">固定资产</option>
            <option value="首台套">首台套</option>
          </select>
        </div>
      </div>
      <div class="layui-form-item">
        <label class="layui-form-label required">申报标题：</label>
        <div class="layui-input-block">
          <input disabled type="text" id="declare_title" name="declare_title" lay-verify="required" lay-reqtext="申报标题不能为空"
                 placeholder="请输入申报标题" value="" class="layui-input">
        </div>
      </div>
      <div class="layui-form-item">
        <label class="layui-form-label required">环节状态：</label>
        <div class="layui-input-block">
          <input disabled type="text" id="link_status" name="link_status" lay-verify="required" lay-reqtext="申报标题不能为空"
                 placeholder="请输入申报标题" value="" class="layui-input">
        </div>
      </div>
      <div class="layui-form-item">
        <label class="layui-form-label required">申报时间：</label>
        <div class="layui-input-block">
          <input disabled type="text" id="declaration_time" name="declaration_time" value="" class="layui-input">
        </div>
      </div>
      <fieldset class="layui-elem-field layui-field-title" style="margin-top: 50px;">
        <legend>申报指南：</legend>
      </fieldset>
      <table class="layui-hide" id="table_step2_2" lay-filter="currentTableFilter_step2"></table>
      <!-- step-3 -->
      <fieldset class="layui-elem-field layui-field-title" style="margin-top: 50px;">
        <legend>复核申报指南：</legend>
      </fieldset>
      <textarea disabled id="check_application_guide" name="check_application_guide" style="width: 50%;margin-left: 36px;"
                rows="10" cols="10" required lay-verify="required" placeholder="请输入" class="layui-textarea"></textarea>
      <!-- step-4 -->
      <fieldset class="layui-elem-field layui-field-title" style="margin-top: 30px;">
        <legend>项目申报及复核：<legend>
      </fieldset>
      <!-- table1 -->
      <table class="layui-hide" id="table_step4_1" lay-filter="currentTableFilter_step4_1"></table>
      <!-- table2 -->
      <table class="layui-hide" id="table_step4_2" lay-filter="currentTableFilter_step4_2"></table>
      <!-- step-4 -->
    </div>
    <div class="layui-tab">
      <!--<fieldset class="layui-elem-field layui-field-title" style="margin-top: 50px;">
      <legend>项目复核：</legend>
    </fieldset>
    <div class="layui-tab-content">
      <div class="layui-tab-item layui-show">
        <table class="layui-hide" id="table_step5_1" lay-filter="currentTableFilter_step5"></table>
      </div>
    </div>-->

      <fieldset class="layui-elem-field layui-field-title" style="margin-top: 50px;">
        <legend>室务会审议项目审核意见：</legend>
      </fieldset>
      <div class="layui-tab-content">
        <div class="layui-tab-item layui-show">
          <table class="layui-hide" id="table_step6_1" lay-filter="currentTableFilter_step6"></table>
        </div>
      </div>
      <div id="selectExperts">
      <div class="layui-tab">
        <fieldset class="layui-elem-field layui-field-title" style="margin-top: 50px;">
          <legend>选定技术评审机构（专家）：</legend>
        </fieldset>
        <ul class="layui-tab-title">
          <li class="layui-this">规划协调处</li>
          <li>机关党委</li>
        </ul>
        <div class="layui-tab-content">
          <div class="layui-tab-item layui-show">
            <table class="layui-hide" id="table_step7_1" lay-filter="currentTableFilter_step7_1"></table>
          </div>
          <div class="layui-tab-item">
            <table class="layui-hide" id="table_step7_2" lay-filter="currentTableFilter_step7_2"></table>
          </div>
        </div>
        <fieldset class="layui-elem-field layui-field-title" style="margin-top: 50px;">
          <legend>复核合同：</legend>
        </fieldset>
        <div class="layui-tab-content">
          <div class="layui-tab-item layui-show">
            <table class="layui-hide" id="table_step8_1" lay-filter="currentTableFilter_step8"></table>
          </div>
        </div>
      </div>
      </div>
        <div id="technicalReview">
          <div class="layui-tab">
            <fieldset class="layui-elem-field layui-field-title" style="margin-top: 50px;">
              <legend>技术评审：</legend>
            </fieldset>
            <ul class="layui-tab-title">
              <li class="layui-this">规划协调处</li>
              <li>机关党委</li>
            </ul>
            <div class="layui-tab-content">
              <div class="layui-tab-item layui-show">
                <table class="layui-hide" id="table_step9_1" lay-filter="currentTableFilter_step9_1"></table>
              </div>
              <div class="layui-tab-item">
                <table class="layui-hide" id="table_step9_2" lay-filter="currentTableFilter_step9_2"></table>
              </div>
            </div>
          </div>
        </div>
        <div class="layui-tab" id="selectedReview">
          <fieldset class="layui-elem-field layui-field-title" style="margin-top: 50px;">
            <legend>选定第三方财务审计机构：</legend>
          </fieldset>
          <ul class="layui-tab-title">
            <li class="layui-this">国防工业科技处</li>
            <li>机关党委</li>
          </ul>
          <div class="layui-tab-content">
            <div class="layui-tab-item layui-show">
              <table class="layui-hide" id="table_step10_1" lay-filter="currentTableFilter_step10_1"></table>
            </div>
            <div class="layui-tab-item">
              <table class="layui-hide" id="table_step10_2" lay-filter="currentTableFilter_step10_2"></table>
            </div>
          </div>
          <div>
            <fieldset class="layui-elem-field layui-field-title" style="margin-top: 50px;">
              <legend>复核合同：</legend>
            </fieldset>
            <div class="layui-tab-content">
              <div class="layui-tab-item layui-show">
                <table class="layui-hide" id="table_step11_1" lay-filter="currentTableFilter_step11_1"></table>
              </div>
            </div>
          </div>
        </div>
          <div class="layui-tab" id="financialAudit">
            <fieldset class="layui-elem-field layui-field-title" style="margin-top: 50px;">
              <legend>财务审计：</legend>
            </fieldset>
            <ul class="layui-tab-title">
              <li class="layui-this">国防工业科技处</li>
              <li>机关党委</li>
            </ul>
            <div class="layui-tab-content">
              <div class="layui-tab-item layui-show">
                <table class="layui-hide" id="table_step12_1" lay-filter="currentTableFilter_step12_1"></table>
              </div>
              <div class="layui-tab-item">
                <table class="layui-hide" id="table_step12_2" lay-filter="currentTableFilter_step12_2"></table>
              </div>
            </div>
          </div>
      <div id="shiwuhuiyi">
        <fieldset class="layui-elem-field layui-field-title" style="margin-top: 50px;">
          <legend>室务会审议确定补助项目：</legend>
        </fieldset>
        <div class="layui-tab-content">
          <div class="layui-tab-item layui-show">
            <table class="layui-hide" id="table_step13_1" lay-filter="currentTableFilter_step13"></table>
          </div>
        </div>
      </div>
        <div class="layui-tab-content">
          <fieldset class="layui-elem-field layui-field-title" style="margin-top: 50px;">
            <legend>起草拨付请示：</legend>
          </fieldset>
          <div class="layui-tab-item layui-show">
            <table class="layui-hide" id="table_step14_1" lay-filter="currentTableFilter_step14"></table>
          </div>
        </div>

        <div class="layui-tab-content">
          <fieldset class="layui-elem-field layui-field-title" style="margin-top: 50px;">
            <legend>复核请示：</legend>
          </fieldset>
          <div class="layui-tab-item layui-show">
            <table class="layui-hide" id="table_step15_1" lay-filter="currentTableFilter_step15"></table>
          </div>
        </div>
        <div class="layui-tab">
          <fieldset class="layui-elem-field layui-field-title" style="margin-top: 50px;">
            <legend>资金拨付：</legend>
          </fieldset>
          <ul class="layui-tab-title">
            <li class="layui-this">国防工业科技处</li>
            <li>秘书处</li>
          </ul>
          <div class="layui-tab-content">
            <div class="layui-tab-item layui-show">
              <table class="layui-hide" id="table_step16_1" lay-filter="currentTableFilter_step16_1"></table>
            </div>
            <div class="layui-tab-item">
              <table class="layui-hide" id="table_step16_2" lay-filter="currentTableFilter_step16_2"></table>
            </div>
          </div>
        </div>
        <div class="layui-tab">

          <fieldset class="layui-elem-field layui-field-title" style="margin-top: 50px;">
            <legend>资金监管：</legend>
          </fieldset>
          <button type="button" class="layui-btn layui-btn-primary" id="upload_step17_1">
            <i class="layui-icon">&#xe67c;</i>附件上传
          </button>
          <ul class="layui-tab-title">
            <li id="bgfgykjc" class="layui-this">国防工业科技处</li>
            <li id="bjgdw">机关党委</li>
          </ul>
          <div class="layui-tab-content">
            <div class="layui-tab-item layui-show">
              <table class="layui-hide" id="table_step17_1" lay-filter="currentTableFilter_step17_1"></table>
            </div>
            <div class="layui-tab-item">
              <table class="layui-hide" id="table_step17_2" lay-filter="currentTableFilter_step17_2"></table>
            </div>
          </div>
        </div>
      </div>
      <div class="layui-form-item">
        <div style="text-align:center">
          <button class="layui-btn layui-btn-primary" lay-submit lay-filter="drop" id="stop">驳回</button>
          <button class="layui-btn layui-btn-normal" id="report">提报</button>
        </div>
      </div>
    </div>
  </div>
</div>
  <script type="text/html" id="currentTableBar_step2">
    <a class="layui-btn layui-btn-xs layui-btn data-count-handle" lay-event="download">下载</a>
  </script>
  <script type="text/html" id="currentTableBar_step4">
    <a class="layui-btn layui-btn-xs layui-btn data-count-handle" lay-event="download">下载</a>
  </script>
  <!--<script type="text/html" id="currentTableBar_step5">
  <a class="layui-btn layui-btn-xs layui-btn data-count-handle" lay-event="download">下载</a>
</script>-->
  <script type="text/html" id="currentTableBar_step6">
    <a class="layui-btn layui-btn-xs layui-btn data-count-handle" lay-event="download">下载</a>
  </script>
  <script type="text/html" id="currentTableBar_step7_1">
    <a class="layui-btn layui-btn-xs layui-btn data-count-handle" lay-event="download">下载</a>
  </script>
  <script type="text/html" id="currentTableBar_step7_2">
    <a class="layui-btn layui-btn-xs layui-btn data-count-handle" lay-event="download">下载</a>
  </script>
  <script type="text/html" id="currentTableBar_step8">
    <a class="layui-btn layui-btn-xs layui-btn data-count-handle" lay-event="download">下载</a>
  </script>
  <script type="text/html" id="currentTableBar_step9_1">
    <a class="layui-btn layui-btn-xs layui-btn data-count-handle" lay-event="download">下载</a>
  </script>
  <script type="text/html" id="currentTableBar_step9_2">
    <a class="layui-btn layui-btn-xs layui-btn data-count-handle" lay-event="download">下载</a>
  </script>
  <script type="text/html" id="currentTableBar_step10_1">
    <a class="layui-btn layui-btn-xs layui-btn data-count-handle" lay-event="download">下载</a>
  </script>
  <script type="text/html" id="currentTableBar_step10_2">
    <a class="layui-btn layui-btn-xs layui-btn data-count-handle" lay-event="download">下载</a>
  </script>
  <script type="text/html" id="currentTableBar_step11_1">
    <a class="layui-btn layui-btn-xs layui-btn data-count-handle" lay-event="download">下载</a>
  </script>
  <script type="text/html" id="currentTableBar_step12_1">
    <a class="layui-btn layui-btn-xs layui-btn data-count-handle" lay-event="download">下载</a>
  </script>
<script type="text/html" id="currentTableBar_step12_2">
  <a class="layui-btn layui-btn-xs layui-btn data-count-handle" lay-event="download">下载</a>
</script>
  <script type="text/html" id="currentTableBar_step13">
    <a class="layui-btn layui-btn-xs layui-btn data-count-handle" lay-event="download">下载</a>
  </script>
  <script type="text/html" id="currentTableBar_step14">
    <a class="layui-btn layui-btn-xs layui-btn data-count-handle" lay-event="download">下载</a>
  </script>
  <script type="text/html" id="currentTableBar_step15">
    <a class="layui-btn layui-btn-xs layui-btn data-count-handle" lay-event="download">下载</a>
  </script>
  <script type="text/html" id="currentTableBar_step16_1">
    <a class="layui-btn layui-btn-xs layui-btn data-count-handle" lay-event="download">下载</a>
  </script>
  <script type="text/html" id="currentTableBar_step16_2">
    <a class="layui-btn layui-btn-xs layui-btn data-count-handle" lay-event="download">下载</a>
  </script>
  <script type="text/html" id="currentTableBar_step17_1">
    <a class="layui-btn layui-btn-xs layui-btn data-count-handle" lay-event="download">下载</a>
    <a class="layui-btn layui-btn-xs layui-btn-danger data-count-handle deletea1" lay-event="delete">删除</a>
  </script>
  <script type="text/html" id="currentTableBar_step17_2">
    <a class="layui-btn layui-btn-xs layui-btn data-count-handle" lay-event="download">下载</a>
    <a class="layui-btn layui-btn-xs layui-btn-danger data-count-handle deletea2" lay-event="delete">删除</a>
  </script>
  <script src="../lib/layui-v2.5.5/layui.js" charset="utf-8"></script>
  <script src="../lib/jquery-3.4.1/jquery-3.4.1.min.js"></script>
  <script src="../js/lay-config.js?v=1.0.4" charset="utf-8"></script>
  <script src="../js/ManualPaging.js"></script>
  <script src="../js/util.js"></script>
  <script>
    if (!localStorage.getItem("userName")) {
      window.location = './login-1.html';
    }
    layui.use(['form', 'table', 'laydate', 'upload', 'miniTab'], function() {
      var $ = layui.jquery,
              form = layui.form,
              table = layui.table,
              laydate = layui.laydate,
              upload = layui.upload,
              miniTab = layui.miniTab

      // 日期组件
      laydate.render({
        elem: '#declaration_time' //指定元素
      });

      // 初始值
      $("input[name='link_status']").val(decodeURI(getQueryVariable('name')));

      // 获取数据
      let url = 'pro/queryJmDeclareByTaskID'
      let param = {
        taskID: getQueryVariable('id') // 获取url参数
      }
      if (getQueryVariable('type') === '2') {
        url = 'pro/queryJmDeclareByProcessInstanceID'
        param = {
          processInstanceID: getQueryVariable('id')
        }
        // TODO 删除上传，删除按钮
        $("#report").remove();
        $("#upload_step17_1").remove();
        $("#stop").remove();
      }
      var isusers = function() {
        //判断当前登录用户去除删除按钮
        if (userName == "gfgykjc") {
          $('#bgfgykjc').click();
          $("a").remove(".deletea2");
        } else if (userName == "jgdw") {
          $('#bjgdw').click();
          $("a").remove(".deletea1");
        } else {
          $("a").remove(".deletea1");
          $("a").remove(".deletea2");
        }

      }
      // 获取数据
      $.ajax({
        url: publicurl + url,
        type: 'GET',
        data: param,
        dataType: 'text',
        success: function(result) {
          //表单初始赋值
          if (Object.prototype.toString.call(result) == "[object String]") {
            result = JSON.parse(result)
          }
          if (result.obj.declare) {
            // $('#declare_type').attr('value', result.obj.declare.declare_type);
            $("#declare_type").find("option[value='" + result.obj.declare.declare_type + "']").attr(
                    "selected", true);
            form.render('select', 'selectFilter');
            $('#check_application_guide').val(result.obj.declare.check_application_guide);
            $("input[name='declare_num']").val(result.obj.declare.declare_num);
            $("input[name='declare_title']").val(result.obj.declare.declare_title);
            $("input[name='link_status']").val(decodeURI(getQueryVariable('name')));
            $("input[name='declaration_time']").val(result.obj.declare.declaration_time);
          }

          // 表格初始值
          let params = {
            id: '#table_step2_2',
            data: 'step2',
            tool: '#currentTableBar_step2',
            table,
            result
          }

          renderTable(params)
          // table_step4_1
          table.render({
            elem: '#table_step4_1',
            defaultToolbar: [''],
            data: result.obj['allOrderPresent'] || null,
            cols: [
              [{
                field: 'enterpriseName',
                width: '10%',
                title: '企业（单位）名称',
                align: "center"
              },
                {
                  field: 'area',
                  width: '10%',
                  title: '所属区、县（市）',
                  align: "center"
                },
                {
                  field: 'proName',
                  width: '10%',
                  title: '项目名称',
                  align: "center"
                },
                {
                  field: 'proType',
                  width: '10%',
                  title: '项目类别',
                  align: "center"
                },
                {
                  field: 'filingDept',
                  width: '10%',
                  title: '备案部门',
                  align: "center"
                },
                {
                  field: 'contractAmount',
                  width: '10%',
                  title: '实际投资额',
                  align: "center"
                },
                {
                  field: 'plannedCompletionTime',
                  width: '10%',
                  title: '计划完成时间',
                  align: "center"
                },
                {
                  field: 'concacts',
                  width: '10%',
                  title: '联系人',
                  align: "center"
                },
                {
                  field: 'phone',
                  width: '10%',
                  title: '手机',
                  align: "center"
                }
              ]
            ],
            id: 'table_step4_1',
            page: false,
            skin: 'line',
            done: function(res, curr, count) {}
          });

          renderTable({
            id: '#table_step4_2',
            data: 'step4',
            tool: '#currentTableBar_step4',
            table,
            result
          })

          /* // 表格初始值5
           renderTable({
             id: '#table_step5_1',
             data: 'step5',
             tool: '#currentTableBar_step5',
             table,
             result
           })*/
          // 表格初始值6
          renderTable({
            id: '#table_step6_1',
            data: 'step6',
            tool: '#currentTableBar_step6',
            table,
            result
          })
          // 表格初始值7_1
          renderTable({
            id: '#table_step7_1',
            data: 'step7_1',
            tool: '#currentTableBar_step7_1',
            table,
            result
          })
          // 表格初始值7_2
          renderTable({
            id: '#table_step7_2',
            data: 'step7_2',
            tool: '#currentTableBar_step7_2',
            table,
            result
          })
          // 表格初始值8
          renderTable({
            id: '#table_step8_1',
            data: 'step8',
            tool: '#currentTableBar_step8',
            table,
            result
          })
          // 表格初始值9_1
          renderTable({
            id: '#table_step9_1',
            data: 'step9_1',
            tool: '#currentTableBar_step9_1',
            table,
            result
          })
          // 表格初始值9_2
          renderTable({
            id: '#table_step9_2',
            data: 'step9_2',
            tool: '#currentTableBar_step9_2',
            table,
            result
          })
          console.log("ceshi")
          console.log(result)
          if (result.obj.processDefinitionKey == "Process_1pingshen") {
            //当pingshen时，不渲染10-12表格并且隐藏
            //定义流程
            $("#selectedReview").hide();
            $("#financialAudit").hide();
          }else if(result.obj.processDefinitionKey == "Process_1shenji"){
            $("#technicalReview").hide();
            $("#selectExperts").hide();
          }else if(result.obj.processDefinitionKey == "Process_1qita"){
            console.log("=====")
            $("#selectExperts").hide();
            $("#technicalReview").hide();
            $("#selectedReview").hide();
            $("#financialAudit").hide();
            $("#shiwuhuiyi").hide();
          }
          else {

          }
          // 表格初始值10_1
          renderTable({
            id: '#table_step10_1',
            data: 'step10_1',
            tool: '#currentTableBar_step10_1',
            table,
            result
          })
          // 表格初始值10_2
          renderTable({
            id: '#table_step10_2',
            data: 'step10_2',
            tool: '#currentTableBar_step10_2',
            table,
            result
          })
          // 表格初始值11_1
          renderTable({
            id: '#table_step11_1',
            data: 'step11',
            tool: '#currentTableBar_step11_1',
            table,
            result
          })
          // 表格初始值12_1
          renderTable({
            id: '#table_step12_1',
            data: 'step12_1',
            tool: '#currentTableBar_step12_1',
            table,
            result
          })
          // 表格初始值12_2
          renderTable({
            id: '#table_step12_2',
            data: 'step12_2',
            tool: '#currentTableBar_step12_2',
            table,
            result
          })
          // 表格初始值13
          renderTable({
            id: '#table_step13_1',
            data: 'step13',
            tool: '#currentTableBar_step13',
            table,
            result
          })
          // 表格初始值14
          renderTable({
            id: '#table_step14_1',
            data: 'step14',
            tool: '#currentTableBar_step14',
            table,
            result
          })
          // 表格初始值15
          renderTable({
            id: '#table_step15_1',
            data: 'step15',
            tool: '#currentTableBar_step15',
            table,
            result
          })
          renderTable({
            id: '#table_step16_1',
            data: 'step16_1',
            tool: '#currentTableBar_step16_1',
            table,
            result
          })
          renderTable({
            id: '#table_step16_2',
            data: 'step16_2',
            tool: '#currentTableBar_step16_2',
            table,
            result
          })
          renderTable({
            id: '#table_step17_1',
            data: 'step17_1',
            tool: '#currentTableBar_step17_1',
            table,
            result
          })
          renderTable({
            id: '#table_step17_2',
            data: 'step17_2',
            tool: '#currentTableBar_step17_2',
            table,
            result
          })
          // 删除 删除按钮
          if (getQueryVariable('type') === '2') {
            $("a").remove(".deletea1");
            $("a").remove(".deletea2");
          }
          isusers()
        },
        error: function(err) {
          console.log(err)
        }
      });
      //驳回
      $("#stop").click(function() {
        layer.open({
          id: 1,
          type: 1,
          title: '请输入驳回意见',
          style: 'width:100%;height:auto;',
          content: "<div style='display:flex;justify-content:center;padding:20px'><textarea id='area' style='width:800px;height:135px;'></textarea></div>",
          btn: ['保存', '取消'],
          yes: function(index, layero) {
            localStorage.setItem("TBaoID", 1);
            let tibao = localStorage.getItem("TBaoID");
            console.log(tibao);
            //获取输入框里面的值
            var rejectComment = $("#area").val();
            var param = {
              taskId: getQueryVariable('id'),
              rejectComment: rejectComment
            };
            $.ajax({
              type: "post",
              url: '' + publicurl + 'pro/reject',
              async: false,
              data: param,
              // headers: {'Content-Type': 'application/json'},
              success: function(res) {
                var ele = $(".layuimini-tab .layui-tab-title li.layui-this", parent.document);
                if (ele.length > 0) {
                  var layId = $(ele[0]).attr('lay-id');
                  miniTab.openNewTabByIframe({
                    href: "page/ToDoTasks.html",
                    title: "代办任务",
                  });
                  miniTab.delete(layId, true);
                }

                // window.location.reload()
                //location.reload()
              },
              error: function(request) {
                layer.alert(request.responseJSON.obj, {
                  icon: 2,
                  title: "提示"
                });
              },

            })
          },
          no: function(index, layero) {
            layer.close(index);
          }
        })
      });
      //提报方法
      var upfile = function() {
        localStorage.setItem("TBaoID", 1);
        $.ajax({
          type: "post",
          url: '' + publicurl + 'task/completeTask',
          async: false,
          data: JSON.stringify({
            declaration_time: $('#declaration_time').val(),
            link_status: $('#link_status').val(),
            declare_title: $('#declare_title').val(),
            declare_type: $('#declare_type').val(),
            declare_num: $('#declare_num').val(),
            taskID: getQueryVariable('id'),
            check_application_guide: $('#check_application_guide').val(),
            isSuccess: "true"
          }),
          headers: {
            'Content-Type': 'application/json'
          },
          success: function(res) {
            var ele = $(".layuimini-tab .layui-tab-title li.layui-this", parent.document);
            if (ele.length > 0) {
              var layId = $(ele[0]).attr('lay-id');
              miniTab.openNewTabByIframe({
                href: "page/ToDoTasks.html",
                title: "代办任务",
              });
              miniTab.delete(layId, true);
            }
          },
          error: function(request) {
            layer.alert(request.responseJSON.obj, {
              icon: 2,
              title: "提示"
            });
          }
        });
      }
      //test
      $("#stop").click(function() {

        let trArr = $(".layui-table-body.layui-table-main");
        console.log(trArr)

      })
      // 提报
      $("#report").click(function() {
        if (userName == "gfgykjc") {
          if ($(".layui-table-body.layui-table-main")[$(".layui-table-body.layui-table-main").length - 2].innerText ==
                  "无数据") {
            layer.open({
              content: '请上传文件'
            });
          } else {
            upfile();
          }
        } else if (userName == "jgdw") {
          if ($(".layui-table-body.layui-table-main")[$(".layui-table-body.layui-table-main").length - 1].innerText ==
                  "无数据") {
            layer.open({
              content: '请上传文件'
            });
          } else {
            upfile()
          }
        } else {
          layer.open({
            content: '请上传文件1'
          });
        }
      })
      // 下载和删除5
      /*    table.on('tool(currentTableFilter_step5)', function(obj) {
            downloadOrDelete(obj)
          });*/
      // 下载和删除6
      table.on('tool(currentTableFilter_step6)', function(obj) {
        downloadOrDelete(obj)
      });
      // 下载和删除7_1
      table.on('tool(currentTableFilter_step7_1)', function(obj) {
        downloadOrDelete(obj)
      });
      // 下载和删除7_2
      table.on('tool(currentTableFilter_step7_2)', function(obj) {
        downloadOrDelete(obj)
      });

      // 下载和删除8
      table.on('tool(currentTableFilter_step8)', function(obj) {
        downloadOrDelete(obj)
      });

      // 下载和删除9_1
      table.on('tool(currentTableFilter_step9_1)', function(obj) {
        downloadOrDelete(obj)
      });
      // 下载和删除9_2
      table.on('tool(currentTableFilter_step9_2)', function(obj) {
        downloadOrDelete(obj)
      });
      // 下载和删除10_1
      table.on('tool(currentTableFilter_step10_1)', function(obj) {
        downloadOrDelete(obj)
      });
      // 下载和删除10_2
      table.on('tool(currentTableFilter_step10_2)', function(obj) {
        downloadOrDelete(obj)
      });
      // 下载和删除11_1
      table.on('tool(currentTableFilter_step11_1)', function(obj) {
        downloadOrDelete(obj)
      });
      // 下载和删除12_1
      table.on('tool(currentTableFilter_step12_1)', function(obj) {
        downloadOrDelete(obj)
      });
      // 下载和删除12_2
      table.on('tool(currentTableFilter_step12_2)', function(obj) {
        downloadOrDelete(obj)
      });
      // 下载和删除13
      table.on('tool(currentTableFilter_step13)', function(obj) {
        downloadOrDelete(obj)
      });
      table.on('tool(currentTableFilter_step14)', function(obj) {
        downloadOrDelete(obj)
      });
      table.on('tool(currentTableFilter_step15)', function(obj) {
        downloadOrDelete(obj)
      });
      table.on('tool(currentTableFilter_step16_1)', function(obj) {
        downloadOrDelete(obj)
      });
      table.on('tool(currentTableFilter_step16_2)', function(obj) {
        downloadOrDelete(obj)
      });
      table.on('tool(currentTableFilter_step17_1)', function(obj) {
        downloadOrDelete(obj)
      });
      table.on('tool(currentTableFilter_step17_2)', function(obj) {
        downloadOrDelete(obj)
      });

      // 下载和删除
      table.on('tool(currentTableFilter_step2)', function(obj) {
        downloadOrDelete(obj)
      });

      table.on('tool(currentTableFilter_step4_1)', function(obj) {
        downloadOrDelete(obj)
      });

      table.on('tool(currentTableFilter_step4_2)', function(obj) {
        downloadOrDelete(obj)
      });

      // 文件上传
      var uploadInst = upload.render({
        elem: '#upload_step17_1', //绑定元素
        url: '/pro/uploadFile/', //上传接口
        data: {
          taskID: getQueryVariable('id')
        },
        done: function(res) {
          //上传完毕回调
          layer.open({
            content: '上传成功',
            time: 1500
          });
          // 上传成功后重新渲染表格
          $.ajax({
            url: publicurl + 'pro/queryJmDeclareByTaskID',
            type: 'GET',
            data: {
              taskID: getQueryVariable('id') // 获取url参数
            },
            dataType: 'text',
            success: function(result) {
              if (Object.prototype.toString.call(result) == "[object String]") {
                result = JSON.parse(result)
              }
              renderTable({
                id: '#table_step17_1',
                data: 'step17_1',
                tool: '#currentTableBar_step17_1',
                table,
                result
              })
              renderTable({
                id: '#table_step17_2',
                data: 'step17_2',
                tool: '#currentTableBar_step17_2',
                table,
                result
              })

              isusers();

            },
            error: function(err) {
              console.log(err)
            }
          });
        },
        error: function() {
          //请求异常回调
          layer.open({
            content: '上传失败',
            time: 1500
          });
          setTimeout(() => {
            window.location.reload()
          }, 1500)
        },
        accept: 'file'
      });

    });
  </script>
</body>

</html>
